package com.uchiha.nova.core.model.vo;

import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.uchiha.nova.core.tool.node.INode;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * 行政设置 模型VO
 *
 * @author magic
 */
@Data
@EqualsAndHashCode
@Schema(description = "ChinaArea对象的VO")
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChinaAreaVO implements INode<ChinaAreaVO> {

	private static final long serialVersionUID = 1L;

    
	/**
	 * id
	 */
    @Schema(description = "id")
	private Long id;

	/**
	 * 名称
	 */
	@Schema(description = "名称")
	private String name;
	/**
	 * 父级ID
	 */
	@Schema(description = "父级ID")
	private Long parentId;
	/**
	 * 级别
	 */
	@Schema(description = "级别")
	private String level;
	/**
	 * 简称
	 */
	@Schema(description = "简称")
	private String shortName;
	/**
	 * lng坐标
	 */
	@Schema(description = "lng坐标")
	private String lng;
	/**
	 * lat坐标
	 */
	@Schema(description = "lat坐标")
	private String lat;
	/**
	 * 子元素数量
	 */
	@Schema(description = "子元素数量")
	private Integer childrenNum;
	/**
	 * 状态
	 */
	@Schema(description = "状态")
	private Integer state;


	/**
	 * geo的json数据
	 */
	@Schema(description = "geo的json数据")
	private JSONObject geoJson;


	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<ChinaAreaVO> children;

	@Override
	public List<ChinaAreaVO> getChildren() {
		if (this.children == null) {
			this.children = new ArrayList<>();
		}
		return this.children;
	}

	/**
	 * 是否有子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private Boolean hasChildren;

	@Override
	public Boolean getHasChildren() {
		if (this.children == null||this.children.size()==0) {
			return false;
		}
		return true;
	}


}
